const express = require('express');
const router = express.Router();
const publicModelController = require('../controllers/publicModelController');
const authMiddleware = require('../middleware/authMiddleware');

// 所有公共模型路由都需要验证令牌（确保用户已登录）
router.use(authMiddleware.verifyToken);

// 获取所有公共模型列表
router.get('/', publicModelController.getAllPublicModels);

// 上传新的公共模型
router.post('/upload', publicModelController.uploadPublicModel);

// 获取公共模型详情
router.get('/:modelId', publicModelController.getPublicModelById);

// 下载公共模型
router.get('/:modelId/download', publicModelController.downloadPublicModel);

// 获取公共模型缩略图
router.get('/:modelId/thumbnail', publicModelController.getPublicModelThumbnail);

module.exports = router;